//
//  LocationDemoViewController.m
//  BaiduMapSdkSrc
//
//  Created by shaoting on 13-4-15.
//  Copyright (c) 2013年 baidu. All rights reserved.
//

#import "LocationDemoViewController.h"

@interface LocationDemoViewController ()

@end

@implementation LocationDemoViewController
CLLocationManager * locationManager;

- (void)viewDidLoad {
    [super viewDidLoad];
    locationManager =[[CLLocationManager alloc] init];
    
    [locationManager requestAlwaysAuthorization];//用这个方法，plist中需要NSLocationAlwaysUsageDescription
    
    [locationManager requestWhenInUseAuthorization];//用这个方法，plist里要加字段NSLocationWhenInUseUsageDescription
    
    //   [_mapView updateLocationData:userLocation];
    
    
    if ([CLLocationManager locationServicesEnabled])
    {
        _mapView.mapType = MKMapTypeStandard;
        _mapView.delegate = self;
        _mapView.showsUserLocation = YES;
        [_mapView setUserTrackingMode:MKUserTrackingModeFollow animated:YES];
    }
    
   }


- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
}

#pragma mark -
#pragma mark Map View Delegate Methods
- (void)mapView:(MKMapView *)mapView didUpdateUserLocation:(MKUserLocation *)userLocation
{
    _mapView.centerCoordinate = userLocation.location.coordinate;
}

- (void)mapViewDidFailLoadingMap:(MKMapView *)theMapView withError:(NSError *)error
{
    NSLog(@"error : %@",[error description]);
}


@end
